package com.hopu.community_task.action;

import java.util.List;
import java.util.Map;

import com.hopu.community_task.domain.PageBean;
import com.hopu.community_task.domain.Task;
import com.hopu.community_task.service.TaskServic;
import com.hopu.community_task.service.impl.TaskServicImpl;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;   

// 自文档化
public class TaskAction extends ActionSupport implements ModelDriven<Task>{

	private Task task = new Task();
	private PageBean page=new PageBean();
	
	private TaskServic service = new TaskServicImpl();
	
	// 要跳转的页面地址
	private String tagetUrl;
	
	public String find(){
		
		List<Task> list = service.find(page);
		Map req = (Map) ActionContext.getContext().get("request");
		req.put("taskList", list);
		tagetUrl="main.jsp";
		return SUCCESS;
	}
	
	public String findById(){
		
		task = service.findById(task.getTid());
		tagetUrl="jsp/findTaskById.jsp";
		System.out.println(task);
		return SUCCESS;
	}
	
	public String update_jiequ() {
		String update_jiequ2 = service.update_jiequ2(task);
		return "";
	}
	
	@Override
	public Task getModel() {
		return task;
	}




	public PageBean getPage() {
		return page;
	}




	public void setPage(PageBean page) {
		this.page = page;
	}



	public String getTagetUrl() {
		return tagetUrl;
	}

	
}
